from lib.config.base import BaseConfig
from utils import common, device


class WifiConfig(BaseConfig):
    def __init__(self, path):
        super().__init__(path)

    def is_debug(self):
        debug = common.get_data_value(self.__config, "debug")
        return debug == 1

    def get_ssid(self):
        return common.get_data_value(self.__config, "ssid")

    def get_password(self):
        return common.get_data_value(self.__config, "password")

    def get_tx_power(self):
        """设置wifi天线功率: 5"""
        return common.get_data_value(self.__config, "tx_power")

    def get_hostname(self):
        hostname = common.get_data_value(self.__config, "hostname")

        if not hostname:
            hostname = str(device.info["uname"]["sysname"])
        return hostname
